package com.vote.entity;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

public class Vote {
	private int id;
	 private String topic;
	 private int channelId;
	 private int maxSelectedNum;
	 private int maxUserOption;
	 private Timestamp createTime;
	 private Timestamp updateTime;
	 private Timestamp publishTime;
	 private int aliveTime;
	 private Timestamp closedTime;
	 private int status;
	 private List<VoteOption> voteOptionList=new ArrayList<VoteOption>();
	 
	
	@Override
	public String toString() {
		return "Vote [id=" + id + ", topic=" + topic + ", channelId=" + channelId + ", maxSelectedNum=" + maxSelectedNum
				+ ", maxUserOption=" + maxUserOption + ", createTime=" + createTime + ", updateTime=" + updateTime
				+ ", publishTime=" + publishTime + ", aliveTime=" + aliveTime + ", closedTime=" + closedTime
				+ ", status=" + status + ", voteOptionList=" + voteOptionList + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + aliveTime;
		result = prime * result + channelId;
		result = prime * result + ((closedTime == null) ? 0 : closedTime.hashCode());
		result = prime * result + ((createTime == null) ? 0 : createTime.hashCode());
		result = prime * result + id;
		result = prime * result + maxSelectedNum;
		result = prime * result + maxUserOption;
		result = prime * result + ((publishTime == null) ? 0 : publishTime.hashCode());
		result = prime * result + status;
		result = prime * result + ((topic == null) ? 0 : topic.hashCode());
		result = prime * result + ((updateTime == null) ? 0 : updateTime.hashCode());
		result = prime * result + ((voteOptionList == null) ? 0 : voteOptionList.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vote other = (Vote) obj;
		if (aliveTime != other.aliveTime)
			return false;
		if (channelId != other.channelId)
			return false;
		if (closedTime == null) {
			if (other.closedTime != null)
				return false;
		} else if (!closedTime.equals(other.closedTime))
			return false;
		if (createTime == null) {
			if (other.createTime != null)
				return false;
		} else if (!createTime.equals(other.createTime))
			return false;
		if (id != other.id)
			return false;
		if (maxSelectedNum != other.maxSelectedNum)
			return false;
		if (maxUserOption != other.maxUserOption)
			return false;
		if (publishTime == null) {
			if (other.publishTime != null)
				return false;
		} else if (!publishTime.equals(other.publishTime))
			return false;
		if (status != other.status)
			return false;
		if (topic == null) {
			if (other.topic != null)
				return false;
		} else if (!topic.equals(other.topic))
			return false;
		if (updateTime == null) {
			if (other.updateTime != null)
				return false;
		} else if (!updateTime.equals(other.updateTime))
			return false;
		if (voteOptionList == null) {
			if (other.voteOptionList != null)
				return false;
		} else if (!voteOptionList.equals(other.voteOptionList))
			return false;
		return true;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTopic() {
		return topic;
	}
	public void setTopic(String topic) {
		this.topic = topic;
	}
	public int getChannelId() {
		return channelId;
	}
	public void setChannelId(int channelId) {
		this.channelId = channelId;
	}
	public int getMaxSelectedNum() {
		return maxSelectedNum;
	}
	public void setMaxSelectedNum(int maxSelectedNum) {
		this.maxSelectedNum = maxSelectedNum;
	}
	public int getMaxUserOption() {
		return maxUserOption;
	}
	public void setMaxUserOption(int maxUserOption) {
		this.maxUserOption = maxUserOption;
	}
	public Timestamp getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}
	public Timestamp getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}
	public Timestamp getPublishTime() {
		return publishTime;
	}
	public void setPublishTime(Timestamp publishTime) {
		this.publishTime = publishTime;
	}
	public int getAliveTime() {
		return aliveTime;
	}
	public void setAliveTime(int aliveTime) {
		this.aliveTime = aliveTime;
	}
	public Timestamp getClosedTime() {
		return closedTime;
	}
	public void setClosedTime(Timestamp closedTime) {
		this.closedTime = closedTime;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public List<VoteOption> getVoteOptionList() {
		return voteOptionList;
	}
	public void setVoteOptionList(List<VoteOption> voteOptionList) {
		this.voteOptionList = voteOptionList;
	}
	
}
